      CREATE TABLE IF NOT EXISTS `demo_people` (
       `pid` int(11) NOT NULL AUTO_INCREMENT,
       `name` varchar(22) NOT NULL,
       `phone` varchar(22) NOT NULL,
       PRIMARY KEY (`pid`)
      )

      INSERT INTO `demo_people` (`pid`, `name`, `phone`) VALUES
      (1, 'vikas dwivedi', '09711500404'),
      (2, 'Ravi Shankar', '98262626222'),
      (3, 'hemant Sharma', '29293947474747'),
      (4, 'Madhulika sharma', '9835635353353'),
      (5, 'Vishal Dwivedi', '9363636465475'),
      (6, 'Prakash Dwivedi', '92846464463');

    CREATE TABLE IF NOT EXISTS `demo_property` (
     `spid` int(11) NOT NULL AUTO_INCREMENT,
     `pid` int(11) NOT NULL,
     `selling` varchar(255) NOT NULL,
     PRIMARY KEY (`spid`)
    );

    INSERT INTO `demo_property` (`spid`, `pid`, `selling`) VALUES
    (1, 3, 'Old House Farm'),
    (2, 3, 'The Willows'),
    (3, 3, 'Tall Trees'),
    (4, 3, 'The Melksham Florist'),
    (5, 2, 'Tall Trees'),
    (6, 2, 'The Melksham Florist'),
    (7, 1, 'Dun Roamin'),
    (9, 16, 'Noida Ex'),
    (10, 14, 'Yamuna Express Way'),
    (8, 1, 'Dun Roamin');

    mysql> use rnd
    Database changed

    mysql> SELECT * FROM `demo_people`;
    +-----+------------------+----------------+
    | pid | name             | phone          |
    +-----+------------------+----------------+
    |   1 | vikas dwivedi    | 09711500404    |
    |   2 | Ravi Shankar     | 98262626222    |
    |   3 | hemant Sharma    | 29293947474747 |
    |   4 | Madhulika sharma | 9835635353353  |
    |   5 | Vishal Dwivedi   | 9363636465475  |
    |   6 | Prakash Dwivedi  | 92846464463    |
    +-----+------------------+----------------+
    6 rows in set (0.00 sec)

    mysql> SELECT * FROM `demo_property`;
    +------+-----+----------------------+
    | spid | pid | selling              |
    +------+-----+----------------------+
    |    1 |   3 | Old House Farm       |
    |    2 |   3 | The Willows          |
    |    3 |   3 | Tall Trees           |
    |    4 |   3 | The Melksham Florist |
    |    5 |   2 | Tall Trees           |
    |    6 |   2 | The Melksham Florist |
    |    7 |   1 | Dun Roamin           |
    |    8 |   1 | Dun Roamin           |
    +------+-----+----------------------+
    8 rows in set (0.01 sec)

    mysql> select name, phone, selling from demo_people left join demo_property  on demo_people.pid = demo_property.pid;
    +------------------+----------------+----------------------+
    | name             | phone          | selling              |
    +------------------+----------------+----------------------+
    | vikas dwivedi    | 09711500404    | Dun Roamin           |
    | vikas dwivedi    | 09711500404    | Dun Roamin           |
    | Ravi Shankar     | 98262626222    | Tall Trees           |
    | Ravi Shankar     | 98262626222    | The Melksham Florist |
    | hemant Sharma    | 29293947474747 | Old House Farm       |
    | hemant Sharma    | 29293947474747 | The Willows          |
    | hemant Sharma    | 29293947474747 | Tall Trees           |
    | hemant Sharma    | 29293947474747 | The Melksham Florist |
    | Madhulika sharma | 9835635353353  | NULL                 |
    | Vishal Dwivedi   | 9363636465475  | NULL                 |
    | Prakash Dwivedi  | 92846464463    | NULL                 |
    +------------------+----------------+----------------------+

    mysql> select name, phone, selling
       -> from demo_people right join demo_property
       -> on demo_people.pid = demo_property.pid;
    +---------------+----------------+----------------------+
    | name          | phone          | selling              |
    +---------------+----------------+----------------------+
    | hemant Sharma | 29293947474747 | Old House Farm       |
    | hemant Sharma | 29293947474747 | The Willows          |
    | hemant Sharma | 29293947474747 | Tall Trees           |
    | hemant Sharma | 29293947474747 | The Melksham Florist |
    | Ravi Shankar  | 98262626222    | Tall Trees           |
    | Ravi Shankar  | 98262626222    | The Melksham Florist |
    | vikas dwivedi | 09711500404    | Dun Roamin           |
    | vikas dwivedi | 09711500404    | Dun Roamin           |
    +---------------+----------------+----------------------+
    8 rows in set (0.00 sec)

    INSERT INTO `rnd`.`demo_property` (`spid` ,`pid` ,`selling`)VALUES (NULL , '11', 'I am not listed 1'),
    (NULL , '12', 'I am not listed 1')

    mysql> SELECT name, phone, selling FROM demo_people right JOIN demo_people ON demo_people.pid =
    demo_property.pid;

    +---------------+----------------+----------------------+
    | name          | phone          | selling              |
    +---------------+----------------+----------------------+
    | hemant Sharma | 29293947474747 | Old House Farm       |
    | hemant Sharma | 29293947474747 | The Willows          |
    | hemant Sharma | 29293947474747 | Tall Trees           |
    | hemant Sharma | 29293947474747 | The Melksham Florist |
    | Ravi Shankar  | 98262626222    | Tall Trees           |
    | Ravi Shankar  | 98262626222    | The Melksham Florist |
    | vikas dwivedi | 09711500404    | Dun Roamin           |
    | vikas dwivedi | 09711500404    | Dun Roamin           |
    | NULL          | NULL           | I am not listed 1    |
    | NULL          | NULL           | I am not listed 1    |
    +---------------+----------------+----------------------+

    10 rows in set (0.00 sec)




mysql> select name, phone, selling from demo_people left join demo_property  on demo_people.pid = demo_property.pid;
+------------------+----------------+----------------------+
| name             | phone          | selling              |
+------------------+----------------+----------------------+
| vikas dwivedi    | 09711500404    | Dun Roamin           |
| vikas dwivedi    | 09711500404    | Dun Roamin           |
| Ravi Shankar     | 98262626222    | Tall Trees           |
| Ravi Shankar     | 98262626222    | The Melksham Florist |
| hemant Sharma    | 29293947474747 | Old House Farm       |
| hemant Sharma    | 29293947474747 | The Willows          |
| hemant Sharma    | 29293947474747 | Tall Trees           |
| hemant Sharma    | 29293947474747 | The Melksham Florist |
| Madhulika sharma | 9835635353353  | NULL                 |
| Vishal Dwivedi   | 9363636465475  | NULL                 |
| Prakash Dwivedi  | 92846464463    | NULL                 |
+------------------+----------------+----------------------+
11 rows in set (0.00 sec)

mysql> select name, phone, selling from demo_people left join demo_property  on demo_people.pid = demo_property.pid;
+------------------+----------------+----------------------+
| name             | phone          | selling              |
+------------------+----------------+----------------------+
| vikas dwivedi    | 09711500404    | Dun Roamin           |
| vikas dwivedi    | 09711500404    | Dun Roamin           |
| Ravi Shankar     | 98262626222    | Tall Trees           |
| Ravi Shankar     | 98262626222    | The Melksham Florist |
| hemant Sharma    | 29293947474747 | Old House Farm       |
| hemant Sharma    | 29293947474747 | The Willows          |
| hemant Sharma    | 29293947474747 | Tall Trees           |
| hemant Sharma    | 29293947474747 | The Melksham Florist |
| Madhulika sharma | 9835635353353  | NULL                 |
| Vishal Dwivedi   | 9363636465475  | NULL                 |
| Prakash Dwivedi  | 92846464463    | NULL                 |
+------------------+----------------+----------------------+
11 rows in set (0.00 sec)

mysql> select name, phone, selling from demo_people right join demo_property  on demo_people.pid = demo_property.pid;
+---------------+----------------+----------------------+
| name          | phone          | selling              |
+---------------+----------------+----------------------+
| hemant Sharma | 29293947474747 | Old House Farm       |
| hemant Sharma | 29293947474747 | The Willows          |
| hemant Sharma | 29293947474747 | Tall Trees           |
| hemant Sharma | 29293947474747 | The Melksham Florist |
| Ravi Shankar  | 98262626222    | Tall Trees           |
| Ravi Shankar  | 98262626222    | The Melksham Florist |
| vikas dwivedi | 09711500404    | Dun Roamin           |
| vikas dwivedi | 09711500404    | Dun Roamin           |
+---------------+----------------+----------------------+
8 rows in set (0.00 sec)

mysql> select name, phone, selling from demo_people right join demo_people  on demo_people.pid = demo_property.pid;
ERROR 1066 (42000): Not unique table/alias: 'demo_people'
mysql> select name, phone, selling from demo_people right join demo_people  on demo_people.pid = demo_property.pid;
ERROR 1066 (42000): Not unique table/alias: 'demo_people'
mysql> select name, phone, selling from demo_people right join demo_property  on demo_people.pid = demo_property.pid;
+---------------+----------------+----------------------+
| name          | phone          | selling              |
+---------------+----------------+----------------------+
| hemant Sharma | 29293947474747 | Old House Farm       |
| hemant Sharma | 29293947474747 | The Willows          |
| hemant Sharma | 29293947474747 | Tall Trees           |
| hemant Sharma | 29293947474747 | The Melksham Florist |
| Ravi Shankar  | 98262626222    | Tall Trees           |
| Ravi Shankar  | 98262626222    | The Melksham Florist |
| vikas dwivedi | 09711500404    | Dun Roamin           |
| vikas dwivedi | 09711500404    | Dun Roamin           |
+---------------+----------------+----------------------+
8 rows in set (0.00 sec)

mysql> select name, phone, selling from demo_people right join demo_property  on demo_people.pid = demo_property.pid;
+---------------+----------------+----------------------+
| name          | phone          | selling              |
+---------------+----------------+----------------------+
| hemant Sharma | 29293947474747 | Old House Farm       |
| hemant Sharma | 29293947474747 | The Willows          |
| hemant Sharma | 29293947474747 | Tall Trees           |
| hemant Sharma | 29293947474747 | The Melksham Florist |
| Ravi Shankar  | 98262626222    | Tall Trees           |
| Ravi Shankar  | 98262626222    | The Melksham Florist |
| vikas dwivedi | 09711500404    | Dun Roamin           |
| vikas dwivedi | 09711500404    | Dun Roamin           |
+---------------+----------------+----------------------+
8 rows in set (0.00 sec)

mysql> select name, phone, selling from demo_people left join demo_property  on demo_people.pid = demo_property.pid;
+------------------+----------------+----------------------+
| name             | phone          | selling              |
+------------------+----------------+----------------------+
| vikas dwivedi    | 09711500404    | Dun Roamin           |
| vikas dwivedi    | 09711500404    | Dun Roamin           |
| Ravi Shankar     | 98262626222    | Tall Trees           |
| Ravi Shankar     | 98262626222    | The Melksham Florist |
| hemant Sharma    | 29293947474747 | Old House Farm       |
| hemant Sharma    | 29293947474747 | The Willows          |
| hemant Sharma    | 29293947474747 | Tall Trees           |
| hemant Sharma    | 29293947474747 | The Melksham Florist |
| Madhulika sharma | 9835635353353  | NULL                 |
| Vishal Dwivedi   | 9363636465475  | NULL                 |
| Prakash Dwivedi  | 92846464463    | NULL                 |
+------------------+----------------+----------------------+
11 rows in set (0.00 sec)

mysql> SELECT name, phone, selling FROM demo_people right JOIN demo_people ON demo_people.pid =
    ->     demo_property.pid;
ERROR 1066 (42000): Not unique table/alias: 'demo_people'
mysql> SELECT name, phone, selling FROM demo_people right JOIN demo_people ON demo_people.pid = demo_property.pid;
ERROR 1066 (42000): Not unique table/alias: 'demo_people'
mysql> SELECT name, phone, selling FROM demo_people right JOIN demo_property ON demo_people.pid = demo_property.pid;
+---------------+----------------+----------------------+
| name          | phone          | selling              |
+---------------+----------------+----------------------+
| hemant Sharma | 29293947474747 | Old House Farm       |
| hemant Sharma | 29293947474747 | The Willows          |
| hemant Sharma | 29293947474747 | Tall Trees           |
| hemant Sharma | 29293947474747 | The Melksham Florist |
| Ravi Shankar  | 98262626222    | Tall Trees           |
| Ravi Shankar  | 98262626222    | The Melksham Florist |
| vikas dwivedi | 09711500404    | Dun Roamin           |
| vikas dwivedi | 09711500404    | Dun Roamin           |
+---------------+----------------+----------------------+
8 rows in set (0.00 sec)

mysql> SELECT * FROM demo_people;
+-----+------------------+----------------+
| pid | name             | phone          |
+-----+------------------+----------------+
|   1 | vikas dwivedi    | 09711500404    |
|   2 | Ravi Shankar     | 98262626222    |
|   3 | hemant Sharma    | 29293947474747 |
|   4 | Madhulika sharma | 9835635353353  |
|   5 | Vishal Dwivedi   | 9363636465475  |
|   6 | Prakash Dwivedi  | 92846464463    |
+-----+------------------+----------------+
6 rows in set (0.00 sec)

mysql> SELECT * FROM demo_property;
+------+-----+----------------------+
| spid | pid | selling              |
+------+-----+----------------------+
|    1 |   3 | Old House Farm       |
|    2 |   3 | The Willows          |
|    3 |   3 | Tall Trees           |
|    4 |   3 | The Melksham Florist |
|    5 |   2 | Tall Trees           |
|    6 |   2 | The Melksham Florist |
|    7 |   1 | Dun Roamin           |
|    8 |   1 | Dun Roamin           |
+------+-----+----------------------+
8 rows in set (0.00 sec)

mysql> select name, phone, selling from demo_people left join demo_property  on demo_people.pid = demo_property.pid;
+------------------+----------------+----------------------+
| name             | phone          | selling              |
+------------------+----------------+----------------------+
| vikas dwivedi    | 09711500404    | Dun Roamin           |
| vikas dwivedi    | 09711500404    | Dun Roamin           |
| Ravi Shankar     | 98262626222    | Tall Trees           |
| Ravi Shankar     | 98262626222    | The Melksham Florist |
| hemant Sharma    | 29293947474747 | Old House Farm       |
| hemant Sharma    | 29293947474747 | The Willows          |
| hemant Sharma    | 29293947474747 | Tall Trees           |
| hemant Sharma    | 29293947474747 | The Melksham Florist |
| Madhulika sharma | 9835635353353  | NULL                 |
| Vishal Dwivedi   | 9363636465475  | NULL                 |
| Prakash Dwivedi  | 92846464463    | NULL                 |
+------------------+----------------+----------------------+
11 rows in set (0.00 sec)

mysql> select name, phone, selling from demo_people right join  demo_property  on demo_people.pid = demo_property.pid;
+---------------+----------------+----------------------+
| name          | phone          | selling              |
+---------------+----------------+----------------------+
| hemant Sharma | 29293947474747 | Old House Farm       |
| hemant Sharma | 29293947474747 | The Willows          |
| hemant Sharma | 29293947474747 | Tall Trees           |
| hemant Sharma | 29293947474747 | The Melksham Florist |
| Ravi Shankar  | 98262626222    | Tall Trees           |
| Ravi Shankar  | 98262626222    | The Melksham Florist |
| vikas dwivedi | 09711500404    | Dun Roamin           |
| vikas dwivedi | 09711500404    | Dun Roamin           |
+---------------+----------------+----------------------+
8 rows in set (0.00 sec)

mysql> SELECT * FROM demo_property;
+------+-----+----------------------+
| spid | pid | selling              |
+------+-----+----------------------+
|    1 |   3 | Old House Farm       |
|    2 |   3 | The Willows          |
|    3 |   3 | Tall Trees           |
|    4 |   3 | The Melksham Florist |
|    5 |   2 | Tall Trees           |
|    6 |   2 | The Melksham Florist |
|    7 |   1 | Dun Roamin           |
|    8 |   1 | Dun Roamin           |
+------+-----+----------------------+
8 rows in set (0.00 sec)

mysql> insert into demo_property(9,7,'test demo');
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '9,7,'test demo')' at line 1
mysql> insert into demo_property('9','7','test demo');
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''9','7','test demo')' at line 1
mysql> insert into demo_property VALUES ('9','7','test demo');
Query OK, 1 row affected (0.00 sec)

mysql> SELECT * FROM demo_property;
+------+-----+----------------------+
| spid | pid | selling              |
+------+-----+----------------------+
|    1 |   3 | Old House Farm       |
|    2 |   3 | The Willows          |
|    3 |   3 | Tall Trees           |
|    4 |   3 | The Melksham Florist |
|    5 |   2 | Tall Trees           |
|    6 |   2 | The Melksham Florist |
|    7 |   1 | Dun Roamin           |
|    8 |   1 | Dun Roamin           |
|    9 |   7 | test demo            |
+------+-----+----------------------+
9 rows in set (0.00 sec)

mysql> select name, phone, selling from demo_people right join  demo_property  on demo_people.pid = demo_property.pid;
+---------------+----------------+----------------------+
| name          | phone          | selling              |
+---------------+----------------+----------------------+
| hemant Sharma | 29293947474747 | Old House Farm       |
| hemant Sharma | 29293947474747 | The Willows          |
| hemant Sharma | 29293947474747 | Tall Trees           |
| hemant Sharma | 29293947474747 | The Melksham Florist |
| Ravi Shankar  | 98262626222    | Tall Trees           |
| Ravi Shankar  | 98262626222    | The Melksham Florist |
| vikas dwivedi | 09711500404    | Dun Roamin           |
| vikas dwivedi | 09711500404    | Dun Roamin           |
| NULL          | NULL           | test demo            |
+---------------+----------------+----------------------+
9 rows in set (0.00 sec)

mysql> SELECT * FROM demo_property;+------+-----+----------------------+
| spid | pid | selling              |
+------+-----+----------------------+
|    1 |   3 | Old House Farm       |
|    2 |   3 | The Willows          |
|    3 |   3 | Tall Trees           |
|    4 |   3 | The Melksham Florist |
|    5 |   2 | Tall Trees           |
|    6 |   2 | The Melksham Florist |
|    7 |   1 | Dun Roamin           |
|    8 |   1 | Dun Roamin           |
|    9 |   7 | test demo            |
+------+-----+----------------------+
9 rows in set (0.00 sec)

mysql> select * from demo_property a , demo_property b WHERE a.pid = b.spid
    -> ;
+------+-----+----------------------+------+-----+----------------+
| spid | pid | selling              | spid | pid | selling        |
+------+-----+----------------------+------+-----+----------------+
|    1 |   3 | Old House Farm       |    3 |   3 | Tall Trees     |
|    2 |   3 | The Willows          |    3 |   3 | Tall Trees     |
|    3 |   3 | Tall Trees           |    3 |   3 | Tall Trees     |
|    4 |   3 | The Melksham Florist |    3 |   3 | Tall Trees     |
|    5 |   2 | Tall Trees           |    2 |   3 | The Willows    |
|    6 |   2 | The Melksham Florist |    2 |   3 | The Willows    |
|    7 |   1 | Dun Roamin           |    1 |   3 | Old House Farm |
|    8 |   1 | Dun Roamin           |    1 |   3 | Old House Farm |
|    9 |   7 | test demo            |    7 |   1 | Dun Roamin     |
+------+-----+----------------------+------+-----+----------------+
9 rows in set (0.00 sec)

mysql> use try;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> select * from categories;
+----+-----------+-------------+
| id | parent_id | cat_name    |
+----+-----------+-------------+
| 44 |        28 | 1234        |
| 43 |        28 | 123         |
| 42 |        28 | 12          |
| 41 |        28 | wer 222     |
| 40 |        28 | wer 1       |
| 35 |         0 | New Sub Cat |
| 34 |         0 | New Sub Cat |
| 33 |         0 | sub caat    |
| 39 |        44 | 121212      |
| 38 |        35 | 222222      |
| 37 |        35 | 1111        |
| 36 |        33 | asdasdasd   |
| 27 |         0 | efwerwer    |
| 28 |         0 | werwer      |
+----+-----------+-------------+
14 rows in set (0.00 sec)

mysql> SELECT MAX(id) FROM categories;
+---------+
| MAX(id) |
+---------+
|      44 |
+---------+
1 row in set (0.00 sec)

mysql> SELECT MAX(id) as maximum FROM categories;
+---------+
| maximum |
+---------+
|      44 |
+---------+
1 row in set (0.00 sec)

mysql> SELECT MAX(id) as maximum FROM categories WHERE id < (SELECT MAX(id) as maximum FROM categories );
+---------+
| maximum |
+---------+
|      43 |
+---------+
1 row in set (0.00 sec)

mysql> SELECT * FROM `categories`as e WHERE 2=(select count(id) from categories where e.id<=id)
    -> ;
+----+-----------+----------+
| id | parent_id | cat_name |
+----+-----------+----------+
| 43 |        28 | 123      |
+----+-----------+----------+
1 row in set (0.00 sec)

mysql> SELECT * FROM `categories`as e WHERE 3=(select count(id) from categories where e.id<=id);
+----+-----------+----------+
| id | parent_id | cat_name |
+----+-----------+----------+
| 42 |        28 | 12       |
+----+-----------+----------+
1 row in set (0.00 sec)

mysql> SELECT * FROM `categories`as e WHERE 1=(select count(id) from categories where e.id<=id);
+----+-----------+----------+
| id | parent_id | cat_name |
+----+-----------+----------+
| 44 |        28 | 1234     |
+----+-----------+----------+
1 row in set (0.00 sec)

mysql> SELECT *
    ->     FROM `categories`
    ->     WHERE `cat_name` NOT
    ->     REGEXP '^[a-z]';
+----+-----------+----------+
| id | parent_id | cat_name |
+----+-----------+----------+
| 44 |        28 | 1234     |
| 43 |        28 | 123      |
| 42 |        28 | 12       |
| 39 |        44 | 121212   |
| 38 |        35 | 222222   |
| 37 |        35 | 1111     |
+----+-----------+----------+
6 rows in set (0.00 sec)

mysql> SELECT *     FROM `categories`;
+----+-----------+-------------+
| id | parent_id | cat_name    |
+----+-----------+-------------+
| 44 |        28 | 1234        |
| 43 |        28 | 123         |
| 42 |        28 | 12          |
| 41 |        28 | wer 222     |
| 40 |        28 | wer 1       |
| 35 |         0 | New Sub Cat |
| 34 |         0 | New Sub Cat |
| 33 |         0 | sub caat    |
| 39 |        44 | 121212      |
| 38 |        35 | 222222      |
| 37 |        35 | 1111        |
| 36 |        33 | asdasdasd   |
| 27 |         0 | efwerwer    |
| 28 |         0 | werwer      |
+----+-----------+-------------+
14 rows in set (0.00 sec)

mysql> SELECT *     FROM `categories`     WHERE `cat_name` NOT     REGEXP '^[a-z]';
+----+-----------+----------+
| id | parent_id | cat_name |
+----+-----------+----------+
| 44 |        28 | 1234     |
| 43 |        28 | 123      |
| 42 |        28 | 12       |
| 39 |        44 | 121212   |
| 38 |        35 | 222222   |
| 37 |        35 | 1111     |
+----+-----------+----------+
6 rows in set (0.00 sec)

mysql> SELECT *     FROM `categories`     WHERE `cat_name` REGEXP '[^a-z]';
+----+-----------+-------------+
| id | parent_id | cat_name    |
+----+-----------+-------------+
| 44 |        28 | 1234        |
| 43 |        28 | 123         |
| 42 |        28 | 12          |
| 41 |        28 | wer 222     |
| 40 |        28 | wer 1       |
| 35 |         0 | New Sub Cat |
| 34 |         0 | New Sub Cat |
| 33 |         0 | sub caat    |
| 39 |        44 | 121212      |
| 38 |        35 | 222222      |
| 37 |        35 | 1111        |
+----+-----------+-------------+
11 rows in set (0.00 sec)

mysql> SELECT *     FROM `categories`     WHERE `cat_name` REGEXP '[^ a-z]';
+----+-----------+----------+
| id | parent_id | cat_name |
+----+-----------+----------+
| 44 |        28 | 1234     |
| 43 |        28 | 123      |
| 42 |        28 | 12       |
| 41 |        28 | wer 222  |
| 40 |        28 | wer 1    |
| 39 |        44 | 121212   |
| 38 |        35 | 222222   |
| 37 |        35 | 1111     |
+----+-----------+----------+
8 rows in set (0.00 sec)

mysql> SELECT *     FROM `categories`     WHERE `cat_name` REGEXP '^[^ a-z]';
+----+-----------+----------+
| id | parent_id | cat_name |
+----+-----------+----------+
| 44 |        28 | 1234     |
| 43 |        28 | 123      |
| 42 |        28 | 12       |
| 39 |        44 | 121212   |
| 38 |        35 | 222222   |
| 37 |        35 | 1111     |
+----+-----------+----------+
6 rows in set (0.00 sec)
